package com.example.demo;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.web.context.WebServerInitializedEvent;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.event.EventListener;
import org.springframework.core.annotation.Order;
import org.springframework.scheduling.annotation.Async;

/**
 * 启动监听
 */
@Configuration
@Slf4j
public class StartEventListener {

    public StartEventListener() {
    }

    @Async
    @Order
    @EventListener({WebServerInitializedEvent.class})
    public void afterStart(WebServerInitializedEvent event) {
        log.info("启动完成");
        /** do something */
    }

}
